_PYVER=`python -c "import sys; print sys.version[:3]"`
_PREFIX=`python -c "import sys; print sys.prefix"`
PYVER 	?= ${_PYVER}
PREFIX 	?= ${_PREFIX}
DESTDIR ?= ./

all:
	python setup.py build

clean:
	python setup.py clean --all
	rm -rf ./build
	rm -rf ./dist
	rm -rf ./debian/lh-abc
	rm -f build-stamp configure-stamp
	find . -name *.pyc -exec rm {} \;

install:
	python setup.py install --prefix=$(PREFIX)
	
uninstall:
	-rm $(PREFIX)/bin/lh-abc.py
	-rm -r $(PREFIX)/lib/python$(PYVER)/site-packages/BitTornado
	-rm -r $(PREFIX)/lib/python$(PYVER)/site-packages/LMG
	-rm -r $(PREFIX)/lib/python$(PYVER)/site-packages/khashmir
	-rm -r $(PREFIX)/lib/python$(PYVER)/site-packages/LH_ABC*.egg-info
	-rm -r $(PREFIX)/share/lh-abc
	-rm $(PREFIX)/share/applications/lh-abc.desktop

deb-pkg: clean
	dpkg-buildpackage -rsudo

rpm-pkg: clean
	python setup.py bdist_rpm --group "Applications/Internet"


# /\/\/\/\/\/\ #
#	Helpers
# /\/\/\/\/\/\ #

deb-helper:
	python setup.py install --prefix=$(PREFIX) --root=$(DESTDIR)
